
import config from "@/config"
import http from "@/utils/request"


// 离职申请
export default {

  getLeaveApplyList: {
    url: `${config.API_URL}/departReport/list`,
    name: "获取离职申请列表",
    get: function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  addLeaveApply: {
    url: `${config.API_URL}/departReport/add`,
    name: "添加离职申请",
    post: function (data = {}) {
      return new Promise((resolve, reject) => {
        http.post(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  updateLeaveApply: {
    url: `${config.API_URL}/departReport/update`,
    name: "修改离职申请",
    post: function (data = {}) {
      return new Promise((resolve, reject) => {
        http.post(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  deletedLeaveApply: {
    url: `${config.API_URL}/departReport/deleted`,
    name: "删除离职申请",
    delete: function (data = {}) {
      return new Promise((resolve, reject) => {
        http.delete(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getLeaveApplyDetail: {
    url: `${config.API_URL}/departReport/detail`,
    name: "获取离职申请详情",
    get: function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
}
